<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">短信模板</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form layui-form-pane" lay-filter="{$lay_table}">
                        <input type="hidden" name="id" value="{:array_get($info,'id')}">
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span style="color:#f90c05;">*</span>编号</label>
                            <div class="layui-input-block">
                                <input type="text" name="code" value="{:array_get($info,'code')}" lay-verify="required"
                                       placeholder="请输入编号" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">短信内容</label>
                            <div class="layui-input-block">
                                <textarea name="content" placeholder="请输入..." lay-verify="required" rows="15" class="layui-textarea">{:array_get($info,'content')}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span style="color:#f90c05;">*</span>备注</label>
                            <div class="layui-input-block">
                                <input type="text" name="comment" value="{:array_get($info,'comment')}" lay-verify="required"
                                       placeholder="请输入备注" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="button" lay-submit lay-filter="{$lay_btn}" value="确认提交" class="layui-btn">
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(['index', 'form'], function () {
        const admin = layui.admin;
        const form = layui.form;
        form.render();

        form.on('submit({$lay_btn})', function (obj) {
            const index = parent.layer.getFrameIndex(window.name);
            admin.req({
                url: "{:url('sms_template/editTemplate')}",
                type: 'post',
                data: obj.field,
                done: function (res) {
                    layer.msg("提交成功", {
                        icon: 1
                    });
                    parent.layui.table.reload('lay-smstemplate-index-table'); //重载表格
                    parent.layer.close(index);
                }
            });
        });
    });
</script>
